import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';
import {VxeFormItemProps, VxeGridPropTypes} from "@/components/VxeTable";
import {
  kqDeptSelect
} from '@/api/heng/production';



/**
 */
export const vxeTableColumns: VxeGridPropTypes.Columns = [
  {
    title: '车间名称',
    field: 'cheJianName',
    showOverflow: 'title',
    width: 90,
    align: 'center',
  },
  {
    title: '类型',
    field: 'type',
    showOverflow: 'title',
    formatter: ({ cellValue, row, column }) => {
      let val = '';
      if (!cellValue) {
        return val;
      }
      if(cellValue==1){
        val="正常班"
      }
      if(cellValue==2){
        val="连班"
      }
      if(cellValue==3){
        val="加班"
      }
      return val;
    },
    width: 90,
    align: 'center',
  },
  {
    title: '上午上班',
    field: 'shangwuUpTxt',
    align: 'center',
    width: 90,
  },
  {
    title: '上午下班',
    field: 'shangwuDownTxt',
    align: 'center',
    width: 90,
  },
  {
    title: '中午截至时间',
    field: 'zhongwuLimitTxt',
    align: 'center',
    width: 90,
  },
  {
    title: '下午上班',
    field: 'xiawuUpTxt',
    align: 'center',
    width: 90,
  },
  {
    title: '下午下班',
    field: 'xiawuDownTxt',
    align: 'center',
    width: 90,
  },
  {
    title: '下午截至时间',
    field: 'xiawuLimitTxt',
    align: 'center',
    width: 90,
  },
  {
    title: '晚上上班',
    field: 'wanshangUpTxt',
    align: 'center',
    width: 90,
  },
  {
    title: '晚上下班',
    field: 'wanshangDownTxt',
    align: 'center',
    width: 90,
  },
  {
    title: '备注',
    field: 'remark',
    align: 'center',
    width: 90,
  },

  {
    title: '创建时间',
    field: 'createTime',
    width: 130,
    align: 'center',
  },
  {
    width: 100,
    title: '操作',
    align: 'center',
    field: '',
    slots: { default: 'action' },
    fixed: 'right',
  },
];




export const vxeTableFormSchema: VxeFormItemProps[] = [
  {
    span: 15,
    field: 'keyword',
    title: '搜索',
    itemRender: {
      props: {
        placeholder: '名称',
      },
      name: 'AInput',
    },
  },

  {
    span: 5,
    itemRender: {
      name: 'VxeButtonGroup',
      options: [
        { type: 'reset', content: '重置' },
        { type: 'submit', content: '查询', status: 'primary' },
      ],
    },
  },
];


export const formSchema: FormSchema[] = [

  {
    field: 'deptId',
    label: '车间小组',
    component:"ApiSelect",
    componentProps: {
      api: kqDeptSelect,
      // mode:"multiple",
      resultField:"data.list",
      labelField: 'groupAndUserName',
      valueField: 'id',
    },
    required: false,
  },
];
